It's alive!
As you can see in the video, we finally have a working prototype! There is much to do still, but that hasn't stopped me laughing like a lunatic and running around the house shouting at everyone. We currently have two air jets hooked up to shoot parts into bins. The pressure is kinda weak, so we're going to get smaller diameter hose. Currently we use 1/4" line, but we're going to step down to 1/8". We'll lose less pressure due to the smaller volume of air in the 1/8" hose, and we'll be able to increase the PSI from 45 to about 90.
Always use protection
Helpful tip: The following paragraphs contain basic electrical theory. If you're not familiar with the relationship between current, resistance, and voltage, you can educate yourself here. You don't need to know this, but it helps.
The Belt Buckle (an arduino micro-controller) works the air valves using a small circuit that I (sloppily) soldered together. Here's a diagram of the design that I shamelessly stole from this post on stack exchange:
In our case, the motor in the picture above is an air valve. This one to be exact:
The output pins on the arduino can only handle 40 milliamps of current at 5V, but our air valves draw 600 milliamps of current at 12V. Therefore we must use a separate power supply for the valves, and protect the arduino from them using a MOSFET. These are digital switches that tolerate much larger amounts of current and much higher voltage levels than the arduino. It acts like a light switch, allowing large amounts of current to flow through the air valve but only needing a tiny amount of current from the arduino to turn it on. If you send 5v from the arduino output pin to the gate of the MOSFET, current will flow freely between its source and drain pins (labelled S and D on the diagram), activating the air valve.
We've also got a diode in parallel to the air valve to filter out any stray voltage spikes that may occur when the valve is turned off. The air valves have magnetic coils (known as inductors) in them and those coils resist changes in electrical current flow. We also have a pull down resistor, which keeps the MOSFET from randomly deciding to turn itself on. Using resistors to pull up or pull down your input/output devices is critical to ensure they work correctly.
They grow up so fast
The next steps will be to add a bunch of missing pieces that are rather critical to the system. There is a ton of work still to do, but the following are the top priority for now.
Currently, parts aren't removed from the active parts database after they get put in the bin. This doesn't cause a functional problem in the short term, but it's a bit like never taking out the trash. Your neighbors will eventually call the police to report the scent of death emanating from your house.
We'll tie that in to a part log to track whats been sorted. When we remove parts from the active DB, we'll create an entry in another database, so we have a long-term archive of whats been sorted.
Also, the UI is missing many features. Primarily, I need to be able to see the server logs in real time. When the software is finished, it won't be running from within a code editor like it does now, (I'm using Pycharm, it's lovely) so I won't see the logs unless I build a window in the GUI for them.
Also also, the sorting rules cannot be set from the GUI yet, I have to set them manually in the database.
Also also also, we need to upgrade the air valves, as detailed above. This also includes making another control circuit for each valve.
Longer term goals include a good feeding mechanism, a narrower and longer conveyor belt, better aiming and position of air nozzles, and much more.
Fake it till they make it
Also, the new version of the neural network library we use, PyTorch, will be released in the near future. Hopefully before Christmas. They're promising tons of new features to streamline neural network creation and deployment. This is great news for us, because making a good neural network is a lot of labor. The process consists of capturing pictures, building a training model, validating it, tweaking it, training again, and then repeating that many times over.
Our current neural network can only tell the difference between some types of plates and bricks. It's much too basic to use in production. We don't want to invest time into building and training it though, because the 1.0 version of Pytorch will change a lot, and it will be easier for us to start from scratch. Therefore, we are actually faking the neural network right now. It isn't sorting parts intelligently, it's randomly assigning them. However, the infrastructure for the neural network is in place, and we did have the old neural net working on an old version of the server. I know exactly what the output of the neural net will look like, so connecting the real one in place of the fake one will be relatively easy.
As you can see we are now putting flesh on the bones of this project. I'll be leaving my current employer at the end of December to begin studying software development full time. This will mean that I can spend significantly more time on the machine; I will be relying on this experience to land me job in the future. It's a bit terrifying to walk away from a lucrative job and strike out on your own, but it's even more exciting. I am ready.